<?php

class Admin_Profile_ViewSuccessView extends BlogAdminBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
	    $this->setupHtml($rd, 'blog');
	    /* @var $user User */
		$user = $this->getAttribute('user');
		$ro = $this->getContext()->getRouting();

        /* @var $role UserRole */
        $trusted_user_role = null;
        foreach ($user->Roles as $role) {
            if ($role->role_name === 'trusted-user') {
                $trusted_user_role = $role;
                break;
            }
        }
		
		$this->setAttribute('login_name', $user->login_name);
		$this->setAttribute('trusted', $trusted_user_role instanceof UserRole);
		$this->setAttribute('display_name', $user->display_name);
		$this->setAttribute('email', $user->email);
		$this->setAttribute('website', $user->website);
		$this->setAttribute('edit_route', $ro->gen('profile.edit', array('user_id'=>$user->id)));
		$this->setAttribute('title', 'View profile');
	}
}

?>
